import { IContextMenu } from '@amcax/base';
import { updateModelsVisible } from '@app-nextmesh/utils';
import { Item, Menu } from 'react-contexify';

function Component({ id }: { id: string }) {
  return (
    <Menu id={id}>
      <Item
        id='hide'
        onClick={() => {
          updateModelsVisible('hide');
        }}>
        隐藏全部
      </Item>
      <Item
        id='show'
        onClick={() => {
          updateModelsVisible('show');
        }}>
        显示全部
      </Item>
    </Menu>
  );
}
const show = (): boolean => {
  return true;
};

/**
 * 未选中模型的右键菜单
 */
export const NextMeshContextMenu: IContextMenu = {
  id: 'nextmeshContextMenu',
  show,
  render: (id: string) => (
    <Component
      id={id}
      key={`nextmesh-context-menu-${id}`}
    />
  ),
};
